package com.denlaku.longan.service.impl;

import com.denlaku.longan.anno.RequiredTx;
import com.denlaku.longan.qo.CustomPageQuery;
import com.denlaku.longan.qo.Query;
import com.denlaku.longan.repository.CustomPageRepository;
import com.denlaku.longan.service.CustomPageService;
import com.denlaku.longan.util.SnowflakeUtils;
import com.denlaku.longan.vo.CustomPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author tianx
 */
@Service
public class CustomPageServiceImpl implements CustomPageService {
    @Autowired
    private CustomPageRepository customPageRepository;

    @Override
    @RequiredTx
    public void add(CustomPage customPage) {
        customPage.setId(SnowflakeUtils.nextId());
        customPageRepository.add(customPage);
    }

    @Override
    @RequiredTx
    public void update(CustomPage customPage) {
        customPageRepository.update(customPage);
    }

    @Override
    @RequiredTx
    public void delete(Query query) {
        customPageRepository.delete(query);
    }

    @Override
    public List<CustomPage> list(CustomPageQuery query) {
        return customPageRepository.list(query);
    }

    @Override
    public CustomPage get(Query query) {
        return customPageRepository.get(query);
    }

}
